package com.dyp.listenerdemo.web.listener;

import javax.servlet.*;
import javax.servlet.annotation.WebListener;

//配置拦截路径
//@Component //如果没有这个注解需要把FilterDemoApplication下的ServletComponentScan注解打开
@WebListener
public class SpringWebListener implements ServletContextAttributeListener {
    @Override 
    public void attributeAdded(ServletContextAttributeEvent event) {
        System.out.println(" 新增属性：" + event.getName()  + "=" + event.getValue()); 
    }
 
    @Override 
    public void attributeRemoved(ServletContextAttributeEvent event) {
        System.out.println(" 移除属性：" + event.getName()); 
    }
 
    @Override 
    public void attributeReplaced(ServletContextAttributeEvent event) {
        System.out.println(" 更新属性：" + event.getName()  + "=" + event.getValue()); 
    }
}
